It is well known how to generate three-dimensional computer graphics images by modeling three-dimensional objects as a composite of two dimensional polygons, such as triangles. Texture mapping is then typically used to create more detail and realism in an image without geometrically modeling and rendering every three-dimensional surface.
Texture maps are sampled to determine the color of the display pixels of each polygon that is visible. The appearance of a pixel of an object is typically dependent on several functions such as: RGB components of color, alpha translucency, image depth (Z), and texture coordinates. The function values of an image pixel are determined by interpolation using function gradients in the x and y directions. Functions that are interpolated over triangular areas are of the form: ##EQU1##
where:
f(x,y) is the function at a reference point on the image; ##EQU2## PA1 dx_min is the width of the triangle in the x-direction; PA1 slope 1 is the slope of one side of the triangle; PA1 slope 2 is the slope of a second side of the triangle; and PA1 .DELTA.y is the height of the triangle.
is the function gradient in the x-direction; and ##EQU3##
is the function gradient in the y-direction.
On images where triangular polygons are used, for narrow triangles the interpolation function gradients can exceed the dynamic range of the system. In graphics systems each variable is typically allocated a predetermined number of bits. The number of bits that can be allocated for each variable is limited by the available hardware resources. For example, if a value is represented by an 8-bit integer variable its dynamic range is from 0 to 255. If a large gradient causes the value to exceed 255, then the value can wrap around, causing the wrong value to be stored. For example, if a color value wraps around then the pixel may appear white instead of black.
In a conventional graphics system the color of a polygon is defined by a plane equation consisting of a reference value, a horizontal gradient, and a vertical gradient. The color of each pixel is computed as the color at the center of the pixel. For each pixel, the sampling point is at the pixel center. In general, polygon edges cover only part of a pixel. In a quantized approach, the polygon is displayed in a pixel whenever the center of that pixel is inside of the polygon. In an antialiased approach, the polygon contributes only partially to the pixel color, even when the center of the pixel is outside of the polygon. For these pixels the extrapolated color components could overflow or underflow (i.e. wraparound). The maximum distance error of the sampling point occurs when the polygon edge is near a pixel corner. In this case the distance error is 0.5*sqrt(2) which is 0.7 pixel.
In conventional graphics systems gradient underflow and overflow often causes images to be displayed with artifacts. Such artifacts may include a pixel being displayed in the wrong color, or a pixel that is rendered at the wrong depth (Z), or a pixel with incorrectly sampled texture coordinates. Such artifacts may also cause images to appear to have jagged edges, and generally detract from the quality of the image display. In many graphics systems this poor image quality is accepted as being necessary to achieve desired performance levels.
One prior approach to limiting gradients is illustrated in FIG. 1. The method identifies triangles that are narrower than a defined threshold width and increases the width of those triangles to the minimum width. The width of the triangle in the x-direction is defined by the equation: EQU dx.sub.-- min=(slope 1-slope 2)*.DELTA.y
where:
When the difference between slope 1 and slope 2 is small this indicates a narrow triangle. When the product of the difference of the slopes and the triangle width is less than the minimum width, then the width of the triangle is temporarily increased to at least equal the minimum width, for the purpose of gradient computations.